//
//  Car.h
//  citycar
//
//  Created by Tang JiaQi on 3/15/11.
//  Copyright 2011 HOME. All rights reserved.
//

#import "cocos2d.h"
#import "CarDef.h"
#include "math/TMath_Header.h"

@class Car;

@interface CarController : NSObject{
	Car* owner;
}

@property(nonatomic, retain) Car* owner;

-(id) initWithOwner: (Car*)pCar;
-(void) wheelLeft;//: (float)ratio;
-(void) wheelRight;//: (float)ratio;
-(void) wheelCentral;
-(void) accelerate;
-(void) deaccelerate;

@end

@interface Car : CCLayer{
	CCSprite*		spriteCar;
	TsiU::Vec2		velocity;
	TsiU::Vec2		orientation;
	CarController*	carController;
	BOOL			isFocused;
}
@property(nonatomic, readwrite)	TsiU::Vec2		velocity;
@property(nonatomic, readwrite)	TsiU::Vec2		orientation;
@property(nonatomic, readwrite)	BOOL			isFocused;
@property(nonatomic, retain)	CCSprite*		spriteCar;
@property(nonatomic, retain)	CarController*	carController;

//
+(id) createNewCar: (CarType)type;
-(id) init;
-(void) reset;
-(void) updateCar: (ccTime)dt;

//controller interface
-(void) wheelLeft;//: (float)ratio;
-(void) wheelRight;//: (float)ratio;
-(void) wheelCentral;
-(void) accelerate;
-(void) deaccelerate;

//getter/setter
-(CGPoint) position;
-(void) setPosition: (CGPoint) pos;
-(TsiU::Vec2) velocity;
-(void) setVelocity: (TsiU::Vec2)vel;
-(TsiU::Vec2) orientation;
-(void) setOrientation: (TsiU::Vec2)ori;
-(void) setFocused: (BOOL) val;

//virtual
-(CCSprite*) type2Resource;

@end

@interface CarType1	: Car
{
}
@end

@interface CarType2	: Car
{
}
@end
























